<template>
  <div id="app">

    <router-view></router-view>

  </div>
</template>

<script>

import axios from 'axios'

export default {

  name: 'app',

  created(){

    //第一种方式
    /*axios({
        method: 'get',
        url:'http://easy-mock.com/mock/59cf334bc5c4302238f63f08/test-axios',

        //设置查询字符串参数
        params:{

          name:'leo',
          age:22

        }
      })
        .then((response)=>{
            console.log(response.data)
        })
        .catch((error)=>{
            console.log(error)
        })*/
    /*axios({
        method: 'post',
        url:'http://easy-mock.com/mock/59cf334bc5c4302238f63f08/test-post-mock',
        data:{
          name:'leo'
        }
      })
        .then((response)=>{
            console.log(response.data)
        })
        .catch((error)=>{
           console.log(error)
        })*/

    /*axios({
          method: 'delete',
          url:'http://easy-mock.com/mock/59cf334bc5c4302238f63f08/test-delete'
       })
        .then((response)=>{
            console.log(response.data)
        })
        .catch((error)=>{
            console.log(error)
        })*/
    //第二种方式
    /*axios.post('http://easy-mock.com/mock/59cf334bc5c4302238f63f08/test-post-mock',{
      age:10
    })
      .then((
        response)=>{
        console.log(response.data)
      })
      .catch((error)=>{
       console.log(error)
      })
*/
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
